package com.feiwo.nonego.rpc.proxy.jdk;

import com.feiwo.nonego.rpc.proxy.api.BaseProxyFactory;
import com.feiwo.nonego.rpc.proxy.api.ProxyFactory;
import com.feiwo.nonego.rpc.spi.annotation.SPIClass;

import java.lang.reflect.Proxy;

/**
 *
 *
 * @author feiwo 2025-08-08
 */
@SPIClass
public class JdkProxyFactory<T> extends BaseProxyFactory<T> implements ProxyFactory {

    @SuppressWarnings({"unchecked", "TypeParameterHidesVisibleType"})
    @Override
    public <T> T getProxy(Class<T> clazz) {
        return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class<?>[]{clazz}, objectProxy);
    }
}
